package com.alex.statistics.pojo.result.structureanalysis;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.List;

/**
 * 动态结构分析结果
 */
@Data
public class DynamicStructureResult {

    // 结构变化指数结果（内部类）
    @Data
    @Schema(description = "结构变化指数结果")
    public static class StructureChangeIndexResult {
        @Schema(description = "计算耗时（毫秒）")
        private long computeTime;

        @Schema(description = "基期总数值")
        private Double basePeriodTotal;

        @Schema(description = "报告期总数值")
        private Double reportPeriodTotal;

        @Schema(description = "各组成部分的结构变化详情")
        private List<StructureChangeDetail> details;

        @Schema(description = "整体结构变化指数（各部分变化指数的平均值）")
        private Double overallChangeIndex;

        @Data
        @AllArgsConstructor
        public static class StructureChangeDetail {
            @Schema(description = "组成部分名称")
            private String componentName;

            @Schema(description = "基期占比（百分比）")
            private Double basePeriodProportion;

            @Schema(description = "报告期占比（百分比）")
            private Double reportPeriodProportion;

            @Schema(description = "结构变化指数（变动幅度，百分比）")
            private Double changeIndex;
        }
    }

    // 贡献度分析结果（内部类）
    @Schema(description = "贡献度分析结果")
    @Data
    public static class ContributionResult {
        @Schema(description = "计算耗时（毫秒）")
        private long computeTime;

        @Schema(description = "基期整体总值")
        private Double basePeriodTotal;

        @Schema(description = "报告期整体总值")
        private Double reportPeriodTotal;

        @Schema(description = "整体变动值（报告期-基期）")
        private Double totalChange;

        @Schema(description = "各因素的贡献度详情")
        private List<ContributionDetail> details;

        @Data
        @AllArgsConstructor
        public static class ContributionDetail {
            @Schema(description = "因素名称")
            private String factorName;

            @Schema(description = "基期因素值")
            private Double basePeriodValue;

            @Schema(description = "报告期因素值")
            private Double reportPeriodValue;

            @Schema(description = "因素变动值（报告期-基期）")
            private Double factorChange;

            @Schema(description = "对整体变动的贡献值")
            private Double contributionValue;

            @Schema(description = "贡献度（占整体变动的百分比）")
            private Double contributionRatio;
        }
    }
}
    